package com.buwei.container;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan({ "com.buwei" })
@EnableBinding(Source.class)
@SpringBootApplication
public class SourceServiceApplication {

	public static void main(String[] args) {
		SpringApplication.run(SourceServiceApplication.class, args);
	}
	
//	@Bean
//	@InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "1000", maxMessagesPerPoll = "1"))
//	public MessageSource<AccountCreatedEvent> timerMessageSource1() {
//		System.out.println("sending AccountCreatedEvent");
//		return () -> MessageBuilder
//				.withPayload(new AccountCreatedEvent("this is a AccountCreatedEvent"))
//				.setHeader("type", AccountCreatedEvent.EVENT_TYPE)
//				.build();
//	}
//	
//	@Bean
//	@InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "1000", maxMessagesPerPoll = "1"))
//	public MessageSource<CustomerCreatedEvent> timerMessageSource2() {
//		System.out.println("sending CustomerCreatedEvent");
//		return () -> MessageBuilder
//				.withPayload(new CustomerCreatedEvent("this is a CustomerCreatedEvent"))
//				.setHeader("type", CustomerCreatedEvent.EVENT_TYPE)
//				.build();
//	}
}
